﻿namespace FinalPointSet.Model.Model.MockData
{
    /// <summary>
    /// 模拟数据的节点
    /// </summary>
    public class MockField
    {
        /// <summary>
        /// 字段的索引值
        /// </summary>
        public int Index { get; set; } = 0;

        /// <summary>
        /// 字段的名称
        /// </summary>
        public string FieldName { get; set; } = string.Empty;
        /// <summary>
        /// 字段的备注
        /// </summary>
        public string FieldComment { get; set; } = string.Empty;
        /// <summary>
        /// 字段的类型
        /// </summary>
        public string FieldType { get; set; } = string.Empty;
        /// <summary>
        /// 模拟的类型的ID
        /// </summary>
        public int MockTypeID { get; set; } = -1;
        /// <summary>
        /// 代码
        /// </summary>
        public MockRule Script { get; set; } = new();
        /// <summary>
        /// 参数模板
        /// </summary>
        public MockParamTemplate ParamTemplate { get; set; } = new();
        /// <summary>
        /// 模拟数据传入参数
        /// </summary>
        public string Param { get; set; } = string.Empty;
        public MockField() { }
        public MockField(int index, string fieldName, string fieldComment, string fieldType, int mockTypeID, MockRule script, MockParamTemplate mockParamTemplate, string param)
        {
            Index = index;
            FieldName = fieldName;
            FieldComment = fieldComment;
            FieldType = fieldType;
            MockTypeID = mockTypeID;
            Script = script;
            ParamTemplate = mockParamTemplate;
            Param = param;
        }

        public override string? ToString()
        {
            return $"Index={Index},FieldName={FieldName},FieldComment={FieldComment},FieldType={FieldType},MockTypeID={MockTypeID},Param={Param}";
        }
    }
}
